﻿<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Store1.DataSource = this.Data;
        this.Store1.DataBind();
    }

    private object[] Data
    {
        get
        {
            return new object[]
            {
                new object[] { 1, "", "", "", "", "", "" }
            };
        }
    }
</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
    <title>添加订单</title>
</head>
<body>
    <script type="text/javascript" src="/Scripts/ExtTimeOut.js"></script>
    <script type="text/javascript" src="/Scripts/ExtRequiredFieldPluins.js"></script>
    <form id="Form1" runat="server">
    <script type="text/javascript">
        var getRowClass = function (record) {
            if (record.newRecord) {
                return "new-row";
            }

            if (record.dirty) {
                return "dirty-row";
            }
        }
    </script>
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    <ext:Viewport ID="Viewport" runat="server" Layout="BorderLayout">
        <Items>
            <ext:Panel ID="Panel1" runat="server" Region="North" Split="true" Collapsible="true" 
                Padding="5" Height="60" Layout="FormLayout" LabelAlign="Right" LabelWidth="100">
                <Items>
                <ext:Container ID="Container1" runat="server" Layout="HBoxLayout" MarginSpec="0 0 0 0">
                        <Items>
                            <ext:SelectBox ID="SelectBox1" runat="server" Name="类别" FieldLabel="类别" Flex="1"
                                EmptyText="1" AllowBlank="false" DisplayField="state" ValueField="abbr">
                                <Store>
                                    <ext:Store ID="Store2" runat="server">
                                    </ext:Store>
                                </Store>
                            </ext:SelectBox>
                            <ext:TextField ID="TextField1" runat="server" Name="客户名称" FieldLabel="客户名称" Flex="2"
                                EmptyText="姓名" AllowBlank="false" />
                            <ext:DateField ID="DateField1" runat="server" Name="日期" FieldLabel="日期" Flex="2"
                                EmptyText="2013/1/1" AllowBlank="false" />
                            <ext:TextField ID="TextField2" runat="server" Name="单号" FieldLabel="单号" Flex="2"
                                EmptyText="20130101001" AllowBlank="false" Margins="0 0 0 6" />
                        </Items>
                    </ext:Container>
                    </Items>
            </ext:Panel>
            <ext:Panel ID="Panel2" runat="server" Region="Center" Layout="AccordionLayout" Split="true">
                <Items>
                    <ext:GridPanel ID="GridPanel1" runat="server" StripeRows="true" ClicksToEdit="1"
                         Height="400"  AutoExpandColumn="ID">
                        <TopBar>
                            <ext:Toolbar ID="TopBar" runat="server">
                                <Items>
                                    <ext:ToolbarFill ID="ToolbarFill1" runat="server" />
                                    <%--<ext:Button ID="btRefresh" runat="server" Text="刷新" Icon="ArrowRefresh">
                                        <Listeners>
                                            <Click Handler="#{GridPanel1}.reload();" />
                                        </Listeners>
                                    </ext:Button>--%>
                                    <ext:Button ID="btAdd" runat="server" Text="新增" Icon="Add">
                                        <Listeners>
                                            <Click Handler="#{GridPanel1}.insertRecord(0, {});#{GridPanel1}.startEditing(0, 0);" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:Button ID="btDelete" runat="server" Text="删除" Icon="Delete">
                                        <Listeners>
                                            <Click Handler="#{GridPanel1}.deleteSelected(); #{GridPanel1}.store.load(#{GridPanel1}.store.lastOptions);" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:Button ID="btClear" runat="server" Text="清空" Icon="Cancel">
                                        <Listeners>
                                            <Click Handler="#{GridPanel1}.clear();if (!#{GridPanel1}.hasSelection()) {#{btnDelete}.disable();}" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:Button ID="btSave" runat="server" Text="保存" Icon="Disk">
                                        <%--<Listeners>
                                            <Click Handler="#{GridPanel1}.save();" />
                                        </Listeners>--%>
                                    </ext:Button>
                                    <ext:Button ID="btPrint" runat="server" Text="打印" Icon="Printer">
                                        <Listeners>
                                            <Click Handler="" />
                                        </Listeners>
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                        <Store>
                            <ext:Store ID="Store1" runat="server">
                                <Reader>
                                    <ext:ArrayReader>
                                        <Fields>
                                            <ext:RecordField Name="ID" />
                                            <ext:RecordField Name="Name" />
                                            <ext:RecordField Name="Model" />
                                            <ext:RecordField Name="Qty" />
                                            <ext:RecordField Name="Number" />
                                            <ext:RecordField Name="Price" />
                                            <ext:RecordField Name="Amount" />
                                            <ext:RecordField Name="Remark" />
                                        </Fields>
                                    </ext:ArrayReader>
                                </Reader>
                            </ext:Store>
                        </Store>
                        <ColumnModel ID="ColumnModel1" runat="server">
                            <Columns>
                                <ext:Column ColumnID="ID" Header="编号" DataIndex="ID" Width="100">
                                    <Editor>
                                        <ext:TextField ID="tfID" runat="server" />
                                    </Editor>
                                </ext:Column>
                                <ext:Column ColumnID="Name" Header="产品名称" DataIndex="Name">
                                    <Editor>
                                        <ext:TextField ID="tfName" runat="server" />
                                    </Editor>
                                </ext:Column>
                                <ext:Column ColumnID="Model" Header="规格" DataIndex="Model">
                                    <Editor>
                                        <ext:TextField ID="tfModel" runat="server" />
                                    </Editor>
                                </ext:Column>
                                <ext:Column ColumnID="Qty" Header="件数" DataIndex="Qty">
                                    <Editor>
                                        <ext:TextField ID="tfQty" runat="server" />
                                    </Editor>
                                </ext:Column>
                                <ext:Column ColumnID="Number" Header="数量" DataIndex="Number">
                                    <Editor>
                                        <ext:TextField ID="tfNumber" runat="server" />
                                    </Editor>
                                </ext:Column>
                                <ext:Column ColumnID="Price" Header="单价" DataIndex="Price">
                                    <Editor>
                                        <ext:TextField ID="tfPrice" runat="server" />
                                    </Editor>
                                </ext:Column>
                                <ext:Column ColumnID="Amount" Header="金额" DataIndex="Amount">
                                    <Editor>
                                        <ext:TextField ID="tfAmount" runat="server" />
                                    </Editor>
                                </ext:Column>
                                <ext:Column ColumnID="Remark" Header="备注" DataIndex="Remark">
                                    <Editor>
                                        <ext:TextField ID="tfRemark" runat="server" />
                                    </Editor>
                                </ext:Column>
                                <%--<ext:CommandColumn>
                                    <Commands>
                                        <ext:GridCommand CommandName="Delete" Icon="Cross" Text="删除" />
                                    </Commands>
                                </ext:CommandColumn>--%>
                            </Columns>
                        </ColumnModel>
                        <SelectionModel>
                            <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
                        </SelectionModel>
                        <BottomBar>
                            <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="8" />
                        </BottomBar>
                        <View>
                            <ext:GridView ID="GridView1" runat="server">
                                <GetRowClass Fn="getRowClass" />
                            </ext:GridView>
                        </View>
                    </ext:GridPanel>
                </Items>
            </ext:Panel>
        </Items>
    </ext:Viewport>
    </form>
</body>
</html>
